<extend name="Public/base" />
<block name="body">
    <div class="main-title">
         <h2>{$meta_title}</h2>
    </div>
    <div class="tab-wrap with-padding">
       
        <div class="node-list">
            <div class="tab-pane in">
                <form action="__SELF__" method="POST" class="form-horizontal auth-form">
                 <input type="hidden" name="id" value="{$data.id}" />
                 <input type="hidden" name="city" value="{$data.city}" />
                 <input type="hidden" name="district" value="{$data.district}" />



                    <div class="form-item cf">
                        <label class="item-label">单位名称</label>

                        <div class="controls">
                            <input type="text" class="text input-large form-control form-input-width" name="title" value="{$data.title}" placeholder="" >
                                  
                        </div>

                    </div>
                    <!-- <div class="form-item cf">
                        <label class="item-label">所属上级</label>

                        <div class="controls">
                            <input type="text" class="text input-large form-control form-input-width" name="pid" value="{$data.pid}" placeholder="" >
                                  
                        </div>

                    </div> -->
                    <div class="form-item cf">
                        <label class="item-label">省份</label>

                        <div class="controls">
                            <select name="province" data-role="select_text" class="form-control" style="width:25%">
                                <option value="0">省份</option>
                                <volist name="pro" id="vo">
                                <option value="{$vo.id}" <if condition="$data.province eq $vo[id] ">selected</if> >{$vo.name}</option>                               
                                </volist>
                                   
                            </select>
                                  
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">城市</label>

                        <div class="controls">
                            <select name="city" data-role="select_text" class="form-control" style="width:25%">
                                <option value="0">城市</option>
                                <volist name="city" id="vo">
                                <option value="{$vo.id}" <if condition="$data.type eq 1">selected</if> >{$vo.title}</option>                               
                                </volist>
                                   
                            </select>
                                  
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">地区</label>

                        <div class="controls">
                            <select name="district" data-role="select_text" class="form-control" style="width:25%">
                                <option value="0">地区</option>
                                <volist name="district" id="vo">
                                <option value="{$vo.id}" <if condition="$data.type eq 1">selected</if> >{$vo.title}</option>                               
                                </volist>
                                   
                            </select>
                                  
                        </div>
                    </div>
                    <div class="form-item cf">
                        <label class="item-label">详细地址</label>

                        <div class="controls">
                            <input type="text" class="text input-large form-control form-input-width" name="detail" value="{$data.detail}" placeholder="" >
                                  
                        </div>

                    </div>
                    <div class="form-item cf">
                        <label class="item-label">电话</label>

                        <div class="controls">
                            <input type="text" class="text input-large form-control form-input-width" name="tel" value="{$data.tel}" placeholder="" >
                                  
                        </div>

                    </div>
                    <div class="form-item cf">
                        <label class="item-label">邮箱</label>

                        <div class="controls">
                            <input type="text" class="text input-large form-control form-input-width" name="email" value="{$data.email}" placeholder="" >
                                  
                        </div>

                    </div>
                    <div class="form-item cf">
                        <label class="item-label">传真</label>

                        <div class="controls">
                            <input type="text" class="text input-large form-control form-input-width" name="fax" value="{$data.fax}" placeholder="" >
                                  
                        </div>

                    </div>
                    <div class="form-item cf">
                        <label class="item-label">备注信息</label>

                        <div class="controls">
                            <input type="text" class="text input-large form-control form-input-width" name="remark" value="{$data.remark}" placeholder="" >
                                  
                        </div>

                    </div>
                    <div class="form-item cf">
                        <label class="item-label">排序</label>

                        <div class="controls">
                            <input type="text" class="text input-large form-control form-input-width" name="sort" value="{$data.sort}" placeholder="" >
                                  
                        </div>

                    </div>

                    <input type="hidden" name="a_type" value="{$a_type}" />
                    <div style="margin-top: 20px;"></div>
                    <button type="submit" class="btn submit-btn ajax-post" target-form="auth-form">{:L("_SURE_WITH_SPACE_")}</button>
                    <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">{:L("_RETURN_WITH_SPACE_")}</button>
                    <!-- <input type="submit" name=""/> -->
                </form>
            </div>
        </div>
    </div>

</block>
<block name="script">
    <script type="text/javascript" src="__STATIC__/qtip/jquery.qtip.min.js"></script>
    <link rel="stylesheet" type="text/css" href="__STATIC__/qtip/jquery.qtip.min.css" media="all">
    <script type="text/javascript" charset="utf-8">

    var child=$('select[name=province]').val();
    $.ajax({

        type: "get",

        url: "{:U('Addons/getChild')}",

        data: {
            child: child
        },

        dataType: "json",

        success: function(data) {

            $("select[name=city]").empty();

            $("select[name=city]").append("<option value='0'>-市-</option>");

            for (var i = data.length - 1; i >= 0; i--) {

                if (data[i].id == $('input[name=city]').val()) {

                    $("select[name=city]").append("<option value='" + data[i].id + "' selected >" + data[i].name + "</option>");
                } else {
                    $("select[name=city]").append("<option value='" + data[i].id + "' >" + data[i].name + "</option>");
                }
            }
        }

    });
    var child2 = $('input[name=city]').val();
    $.ajax({

        type: "get",

        url: "{:U('Addons/getChild')}",

        data: {
            child: child2
        },

        dataType: "json",

        success: function(data) {

            $("select[name=district]").empty();

            $("select[name=district]").append("<option value='0'>-区-</option>");

            for (var i = data.length - 1; i >= 0; i--) {
                if (data[i].id == $('input[name=district]').val()) {

                    $("select[name=district]").append("<option value='" + data[i].id + "' selected >" + data[i].name + "</option>");
                } else {
                    $("select[name=district]").append("<option value='" + data[i].id + "' >" + data[i].name + "</option>");
                }
            }
        }

    });
    $('select[name=province]').change(function() {

        var child = $(this).val();
        $.ajax({

            type: "get",

            url: "{:U('Addons/getChild')}",

            data: {
                child: child
            },

            dataType: "json",

            success: function(data) {

                $("select[name=city]").empty();

                $("select[name=city]").append("<option value='0'>-市-</option>");

                for (var i = data.length - 1; i >= 0; i--) {
                    $("select[name=city]").append("<option value='" + data[i].id + "'>" + data[i].name + "</option>");
                }
            }

        });

    });
    $('select[name=city]').change(function() {

        var child = $(this).val();
        $.ajax({

            type: "get",

            url: "{:U('Addons/getChild')}",

            data: {
                child: child
            },

            dataType: "json",

            success: function(data) {

                $("select[name=district]").empty();

                $("select[name=district]").append("<option value='0'>-区-</option>");

                for (var i = data.length - 1; i >= 0; i--) {
                    $("select[name=district]").append("<option value='" + data[i].id + "'>" + data[i].name + "</option>");
                }
            }

        });

    });
        //导航高亮
        highlight_subnav('{:U('index')}');
    </script>
</block>
